home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / v cisle / autoit / autoit-v3.2.0.1-setup.exe / Examples / Helpfile / _GUICtrlTreeViewSetState.au3 < prev    next >
Text File  |  2006-06-17  |  925b  |  38 lines

  1. #include <GUIConstants.au3>
  2. #include <GuiTreeView.au3>
  3.  
  4. Opt("MustDeclareVars", 1)
  5.  
  6. Dim $h_GUI, $Msg, $treeview, $h_search, $s_file, $h_item
  7.  
  8. $h_GUI = GUICreate("TreeView UDF Sample", 220, 220)
  9.  
  10. $treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
  11. GUICtrlSetImage(-1, "shell32.dll", 3, 4)
  12. GUICtrlSetImage(-1, "shell32.dll", 4, 2)
  13.  
  14. GUISetState()
  15.  
  16. $h_search = FileFindFirstFile("C:\*.*")
  17. If $h_search <> -1 Then
  18.     While 1
  19.         $s_file = FileFindNextFile($h_search)
  20.         If @Error Then ExitLoop
  21.         If Not StringInStr(FileGetAttrib("C:\" & $s_file), "D") Then ContinueLoop
  22.         $h_item = _GUICtrlTreeViewInsertItem($treeview, $s_file)
  23.         If StringInStr(FileGetAttrib("C:\" & $s_file), "H") Then
  24.             _GUICtrlTreeViewSetState($treeview, $h_item, $TVIS_CUT)
  25.         EndIf
  26.     WEnd
  27. EndIf
  28.  
  29. While 1
  30.     $Msg = GUIGetMsg()
  31.     Switch $Msg
  32.         Case $GUI_EVENT_CLOSE
  33.             ExitLoop
  34.     EndSwitch
  35. WEnd
  36.  
  37. Exit
  38.